package com.zhao.dota.contant;

import com.zhao.dota.common.contant.BaseEnum;
import com.zhao.dota.exception.TeamCodeException;
import lombok.Getter;
import lombok.NoArgsConstructor;

@NoArgsConstructor
@Getter
public enum TeamConst implements BaseEnum {

    RADIANT("天辉", 2),

    DIRE("夜魇", 3),;

    private String desc;

    private int code;

    TeamConst(String desc, int code) {
        this.desc = desc;
        this.code = code;
    }

    public static TeamConst ofCode(int code) {
        TeamConst[] values = TeamConst.values();
        for (TeamConst team : values) {
            if (team.code == code) {
                return team;
            }
        }
        throw new TeamCodeException("队伍编号异常：" + code);
    }

}
